<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>if语句的练习</title>
</head>
<body>
        <script>
         /*   if (1){             //正确的写法
                var a = 10;
                var d = 20;
                c = d - a;
                console.log(c)
            }
            */


         if (1);{               //if后面加了个分号，代表提前结束，分号前面是空语句，后面的代码不受if控制
             var a = 10;
             var d = 20;
             c = d - a;
             console.log(c)
         }
        </script>
</body>
</html>